// map_of_shared_ptr.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include <map>
#include <memory>
#include <iostream>
#include <string>

typedef std::shared_ptr<int> int_ptr;
typedef std::shared_ptr<std::string> string_ptr;
typedef bool(*cmp_fun)(int_ptr, int_ptr);

bool cmp (int_ptr lhs, int_ptr rhs) 
{
	return *lhs < *rhs;
}

int _tmain(int argc, _TCHAR* argv[])
{
	using namespace std;

	map< int_ptr, string_ptr, cmp_fun > mapIS(cmp);
	
	mapIS[int_ptr(new int(1))] = string_ptr(new string("one"));
	mapIS[int_ptr(new int(2))] = string_ptr(new string("two"));
	mapIS[int_ptr(new int(3))] = string_ptr(new string("three"));
	mapIS[int_ptr(new int(4))] = string_ptr(new string("four"));

	string_ptr strPtr = mapIS[int_ptr(new int(3))];
	cout << "find: " << strPtr.get()  << endl;

	return 0;
}

